package org.oslims.client.view.impl;

import org.oslims.client.uicomponents.editbox.EditCustomerBox;
import org.oslims.client.view.CustomerEditorView;
import org.oslims.domain.Customer;

import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.cellview.client.SimplePager;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class CustomerEditorViewImpl extends BaseViewImpl implements CustomerEditorView {

	final Button addCustomerButton = new Button("Add Customer");
	Integer defaultPageSize = 15;
	final CellTable<Customer> customerTable = new CellTable<Customer>(defaultPageSize);
	final SimplePager<Customer> pager = new SimplePager<Customer>(customerTable);

	EditCustomerBox editCustomerBox = new EditCustomerBox();

	public CustomerEditorViewImpl() {
		VerticalPanel vp = new VerticalPanel();

		ScrollPanel sp = new ScrollPanel();
		sp.add(customerTable);
		vp.add(sp);

		vp.add(pager);
		vp.add(addCustomerButton);

		initWidget(vp);
	}

	@Override
	public HasClickHandlers getAddCustomerButton() {
		return addCustomerButton;
	}

	@Override
	public CellTable<Customer> getTable() {
		return customerTable;
	}

	@Override
	public EditCustomerBox getEditCustomerBox() {
		return editCustomerBox;
	}

	@Override
	public Integer getDefaultPageSize() {
		return defaultPageSize;
	}

	@Override
	public SimplePager<Customer> getPager() {
		return pager;
	}

}
